package com.kokomi.handler;

import com.kokomi.pojo.enumeration.BookBusinessException;
import com.kokomi.pojo.enumeration.ResultCode;

/**
 * 自定义断言类
 */
public class Assert {

    /**
     * 断言方法
     *
     * @param condition  如果条件成立则抛出异常
     * @param resultCode 异常错误码对象
     */
    public static void error(boolean condition, ResultCode resultCode) {
        if (condition) {
            throw new BookBusinessException(resultCode);
        }
    }
}
